<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>合作成果列表</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.7 -->
    <!--link导入外部的css，js样式，如果导入的资源和本页面在同一个文件夹下，直接文件名即可-->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/bootstrap/dist/css/bootstrap.min.css}">
    <!-- jQuery 3 -->
    <script th:src="@{/asserts/bower_components/jquery/dist/jquery.min.js}"></script>
    <!-- Bootstrap 3.3.7 -->
    <script th:src="@{/asserts/bower_components/bootstrap/dist/js/bootstrap.min.js}"></script>
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/font-awesome/css/font-awesome.min.css}">
    <!-- Ionicons -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/Ionicons/css/ionicons.min.css}">
    <!-- DataTables -->
    <link rel="stylesheet" th:href="@{/asserts/bower_components/datatables.net-bs/css/dataTables.bootstrap.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/asserts/dist/css/AdminLTE.min.css}">
    <!--MySources-->
    <script th:src="@{/asserts/Apolar_sh/lib/layer/2.4/layer.js}"></script>
    <script th:src="@{/asserts/Apolar_sh/lib/js/bigautocomplete.js}"></script>
    <script th:src="@{/asserts/Apolar_sh/lib/js/teacher.js}"></script>
    <script th:src="@{/asserts/Apolar_sh/lib/js/topic.js}"></script>
    <link rel="stylesheet" th:href="@{/asserts/Apolar_sh/lib/css/bigautocomplete.css}" type="text/css"/>
    <script th:src="@{/asserts/Apolar_sh/lib/js/fileinput.min.js}"></script>
    <script th:src="@{/asserts/Apolar_sh/lib/js/fileinput_locale_zh.js}"></script>
    <link th:href="@{/asserts/Apolar_sh/lib/css/fileinput.min.css}" media="all" rel="stylesheet" type="text/css"/>

    <!-- Google Font -->
    <link rel="stylesheet"
          href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
    <style type="text/css">

        * {
            margin: 0;
            padding: 0;
            list-style-type: none;
        }

        .search {
            margin-top: 40px;
            margin-left: 40px;
            position: relative;
        }

        #myTable td {
            text-align: center;
        }

        th {
            text-align: center;
        }

        ul li a {
            font-size: 10px;
        }

        .startBox {
            width: 320px;
            height: 60px;
            margin: 0 auto;
            display: flex;
            flex-direction: row-reverse;
            justify-content: space-between;
        }

        input[type="radio"] {
            display: none;
        }

        input[type="radio"] + label > svg > path {
            d: path("M27.500,1.501 L36.069,16.899 L53.497,20.217 L41.365,33.051 L43.567,50.499 L27.500,43.032 L11.433,50.499 L13.635,33.051 L1.503,20.217 L18.931,16.899 L27.500,1.501 ");
            stroke-width: 1px;
            fill: none;
            stroke: #333;
        }

        input[type="radio"] + label:hover > svg > path,
        input[type="radio"] + label:hover ~ input[type="radio"] + label > svg > path,
        input[type="radio"]:checked + label > svg > path,
        input[type="radio"]:checked ~ input[type="radio"] + label > svg > path {
            stroke-width: 0px;
            fill: #f00;
        }

        #top {
            background-color: rgba(172, 175, 175, 0.78);
            display: none;
            position: fixed;
            right: -3px;
            bottom: 130px;
            z-index: 9999;
        }

        #top a {
            color: rgba(61, 61, 61, 0.91);
            font-size: 45px;
        }

        #home {
            display: block;
            position: absolute;
            right: 10px;
            top: 8px;
            z-index: 9999;
            font-size: 30px;
        }

        #refresh {
            display: block;
            position: absolute;
            right: 46px;
            top: 10px;
            z-index: 9999;
            font-size: 26px;
        }
    </style>


</head>
<body>
<a id="up"></a>
<div id="top">
    <a href="#up" title="回到顶部" class="fa fa-angle-double-up"></a>
</div>
<span>
    <a th:if="${comId==null}" id="refresh" class="fa fa-refresh"  href="javascript:location.reload()"></a>
    <a th:if="${comId==null}" id="home" class="fa fa-home" th:href="@{/cr/crShow}"></a>
    <a th:if="${comId!=null}" id="home" class="fa fa-refresh"  href="javascript:location.reload()"></a>
</span>
<div class="wrapper" style="width: 100%;">
    <!-- Content Wrapper. Contains page content -->
    <!-- Content Header (Page header) -->
    <!-- Main content -->
    <section class="content-header" style="padding-top: 10px;">
        <h4>
            <i class="fa fa-search"></i> 搜索合作成果
        </h4>
    </section>
    <div class="search" style="margin-top: 0;width: 100%;">
        <div class="row" style="margin-top: 0;width: 100%;">
            <div class="col-xs-8" style="margin-left: 1%;margin-top: 0;width: 100%;">
                <form class="form-inline"
                      th:action="@{/cr/crSearchShow(pageSize=${pageSize})}" method="post">
                    <span class="form-group">
                        <label>成果主题：</label>
                        <input id="crTopic" type="text"
                               th:if="${ccrc}==null"
                               style="width: 140px;"
                               class="form-control input-sm"
                               name="ccrcTopic"
                               placeholder="请输入成果主题">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->
                        <input id="crTopic" type="text"
                               th:if="${ccrc}!=null"
                               style="width: 140px;"
                               class="form-control input-sm"
                               name="ccrcTopic"
                               placeholder="请输入成果主题"
                               th:value="${ccrc.ccrcTopic}">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->
                    </span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="form-group">
                        <label>授课讲师：</label>
                        <input id="crCourseTeacher"
                               th:if="${ccrc}==null"
                               style="width: 140px;"
                               type="text"
                               class="form-control input-sm"
                               name="ccrcCourseTeacher"
                               placeholder="请输入授课讲师">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->
                        <input id="crCourseTeacher"
                               th:if="${ccrc}!=null"
                               style="width: 140px;"
                               type="text"
                               class="form-control input-sm"
                               name="ccrcCourseTeacher"
                               placeholder="请输入授课讲师"
                               th:value="${ccrc.ccrcCourseTeacher}">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->
                    </span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="form-group">
                        <label>销售专员：</label>
                        <input id="crSales" th:if="${ccrc}==null"
                               style="width: 140px;"
                               type="text"
                               class="form-control input-sm"
                               name="ccrcSales"
                               placeholder="请输入销售专员">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->
                        <input id="crSales"
                               th:if="${ccrc}!=null"
                               style="width: 140px;"
                               type="text"
                               class="form-control input-sm"
                               name="ccrcSales"
                               placeholder="请输入销售专员"
                               th:value="${ccrc.ccrcSales}">
                        <!--                               onchange="if(/[\d]/g.test(value)){layer.msg('格式不对哦!请输入字母或中文', {icon: 0, time: 1500});value='';}">-->

                    </span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <span class="form-group">
                        <label>成果日期：</label>
                        <input id="crDate"
                               th:if="${ccrc}==null"
                               type="date"
                               class="form-control input-sm"
                               name="ccrcDate">
                        <input id="crDate"
                               th:if="${ccrc}!=null"
                               type="date"
                               class="form-control input-sm"
                               name="ccrcDate"
                               th:value="${ccrc.ccrcDate}">
                    </span>&nbsp;&nbsp;&nbsp;&nbsp;
                    <button id="submitBtn" type="submit" class="btn btn-success btn-sm"><i class="fa fa-search"></i>
                        一键搜索
                    </button>
                </form>
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </div>

    <!-- /.content -->

</div>
<div class="wrapper" style="overflow:hidden;">
    <!-- Content Wrapper. Contains page content -->
    <!-- Content Header (Page header) -->
    <section class="content-header" style="padding-top: 0;padding-bottom: 2px;overflow: hidden">
        <h4>
            <i class="fa fa-navicon"></i> 合作成果列表
        </h4>
        <span style="font-size: 15px;">每页显示：</span>
        <select id="pageSize" name="pageSize" style="height:25px;width: 45px;padding-right: 0;"
                th:onchange="pageFun(this)">
            <option th:selected="${pageSize==5}" value="5">5</option>
            <option th:selected="${pageSize==10}" value="10">10</option>
            <option th:selected="${pageSize==20}" value="20">20</option>
        </select>
        <span style="margin: 0 0 0 77%;">
            <a th:if="${info!=null}" class="btn btn-info btn-sm"
               th:href="@{crAddUI(currentPage=1,pageSize=5)}"><i
                    class="fa fa-plus"></i> 添加合作成果</a>
            <a th:if="${info==null}" class="btn btn-info btn-sm"
               th:href="@{crAddUI(currentPage=${pageBean.pageNum},pageSize=${pageSize})}"><i
                    class="fa fa-plus"></i> 添加合作成果</a>
        </span>
    </section>

    <!-- Main content -->
    <section class="content" style="padding-top: 0;overflow:hidden;">
        <div class="row">
            <div class="col-xs-12">
                <div class="box">
                    <div th:if="${info!=null&&ccrc!=null}" class="box-body" style="color: red;font-size: 20px;">
                        [[${info}]]
                    </div>
                    <div th:if="${info!=null&&ccrc==null}" class="box-body" style="color: red;font-size: 20px;">
                        [[${info}]]<br>
                        <a class="btn btn-primary btn-sm" th:href="@{/cr/exportTemplate}"
                           onclick="layer.msg('正在导出,请稍等...', { icon: 1, time: 1000 });">
                            <i class="fa fa-download"></i> 导出当前页EXCEL模板
                        </a>
                        <a class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mydialog1">
                            <i class="fa fa-upload"></i> 导入EXCEL
                        </a>
                    </div>
                    <!-- Excel Modal -->
                    <div class="modal fade" id="mydialog1"
                         tabindex="-1" role="dialog" data-backdrop='static'
                         aria-labelledby="myModalLabel">
                        <div class="modal-dialog" role="document">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <h4 class="modal-title" style="text-align: center;">
                                        <i class="fa fa-upload"></i>&nbsp;&nbsp;导入EXCEL
                                    </h4>
                                </div>
                                <div class="modal-body">
                                    <form id="uploadForm" enctype="multipart/form-data">
                                        <div class="form-group">
                                            <input id="input-b2" name="file" size="100" type="file" class="file"
                                                   data-show-preview="true"
                                                   data-show-upload="false"
                                                   data-show-cancel="false"
                                                   accept="application/vnd.ms-excel"
                                                   placeholder="请选择一个Excel文件">
                                        </div>
                                        <div class="modal-footer" style="padding-right: 0;padding-bottom:0;">
                                            <button type="button" class="btn btn-default btn-sm"
                                                    data-dismiss="modal">
                                                <i class="fa fa-close"></i> &nbsp;&nbsp;取&nbsp;&nbsp;消&nbsp;&nbsp;
                                            </button>
                                            <button type="button" class="btn btn-success btn-sm"
                                                    th:onclick="uploadExcel()">
                                                <i class="fa fa-upload"></i> &nbsp;&nbsp;上&nbsp;&nbsp;传&nbsp;&nbsp;
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- Excel Modal -->
                    <div th:if="${info==null}" class="box-body">
                        <table id="myTable" class="table table-bordered table-striped">
                            <thead>
                            <tr>
                                <th>选择</th>
                                <th>合作日期</th>
                                <th>成果类型</th>
                                <th>成果主题</th>
                                <th>参与对象</th>
                                <th>授课讲师</th>
                                <th>销售专员</th>
                                <th>课程评价</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr th:each="cr:${pageBean.list}">
                                <td style="padding-top: 14px;">
                                    <input type="checkbox" name="crIds" th:value="${cr.crId}" id="checkId"
                                           th:onchange="recordId(this)">
                                </td>
                                <td style="padding-top: 14px;">[[${#dates.format(cr.crDate, 'yyyy-MM-dd')}]]</td>
                                <td style="padding-top: 14px;">[[${cr.crType}]]</td>
                                <td style="padding-top: 14px;">[[${cr.crTopic}]]</td>
                                <td>
                                    <a th:if="${ccrc==null}" class="btn btn-info btn-sm"
                                       th:href="@{/cc/ccShow(ccCrId=${cr.crId},currentPage=${pageBean.pageNum},pageSize=${pageBean.pageSize})}">
                                        <i class="fa fa-building-o"></i> 参与公司
                                    </a>
                                    <a th:if="${ccrc!=null}" class="btn btn-info btn-sm"
                                       th:href="@{/cc/ccShow(ccCrId=${cr.crId},comId=${ccrc.ccrcComId},ccrcDate=${ccrc.ccrcDate}, ccrcCourseTeacher=${ccrc.ccrcCourseTeacher},ccrcTopic=${ccrc.ccrcTopic},ccrcSales=${ccrc.ccrcSales},currentPage=${pageBean.pageNum},pageSize=${pageBean.pageSize})}">
                                        <i class="fa fa-building-o"></i> 参与公司
                                    </a>
                                </td>
                                <td style="padding-top: 14px;">[[${cr.crCourseTeacher}]]</td>
                                <td style="padding-top: 14px;">[[${cr.crSales}]]</td>
                                <td>
                                    <a class="btn btn-info btn-sm" data-toggle="modal"
                                       th:data-target="${'#courseModal'+cr.crId}">
                                        <i class="fa fa-edit"></i> 课程评价
                                    </a>
                                    <!-- Modal -->
                                    <div class="modal fade" th:id="${'courseModal'+cr.crId}" tabindex="-1"
                                         role="dialog" data-backdrop='static'
                                         aria-labelledby="myModalLabel">
                                        <div class="modal-dialog" role="document">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <h4 class="modal-title" id="myModalLabel"><i
                                                            class="fa fa-edit"></i> 课程评价
                                                    </h4>
                                                </div>
                                                <div class="modal-body">
                                                    <div class="row">
                                                        <div class="col-sm-12">
                                                            <div class="box" style="width: 100%;margin: 0 auto;">
                                                                <div class="box-body">
                                                                    <form style="text-align: center;">
                                                                        <div class="form-group">
                                                                            <label style="color: red">亲，给个五星好评哦！</label>
                                                                            <div>
                                                                                <div class="startBox">
                                                                                    <input type="radio"
                                                                                           th:id="${'one'+cr.crId}"
                                                                                           th:name="${'crCourseGrade'+cr.crId}"
                                                                                           th:value="5"
                                                                                           th:checked="${cr.crCourseGrade=='5'}">
                                                                                    <label th:for="${'one'+cr.crId}">
                                                                                        <svg xmlns="http://www.w3.org/2000/svg"
                                                                                             width="56.5px"
                                                                                             height="53.5px">
                                                                                            <path/>
                                                                                        </svg>
                                                                                    </label>
                                                                                    <input type="radio"
                                                                                           th:id="${'two'+cr.crId}"
                                                                                           th:name="${'crCourseGrade'+cr.crId}"
                                                                                           th:value="4"
                                                                                           th:checked="${cr.crCourseGrade=='4'}">
                                                                                    <label th:for="${'two'+cr.crId}">
                                                                                        <svg xmlns="http://www.w3.org/2000/svg"
                                                                                             width="56.5px"
                                                                                             height="53.5px">
                                                                                            <path/>
                                                                                        </svg>
                                                                                    </label>
                                                                                    <input type="radio"
                                                                                           th:id="${'three'+cr.crId}"
                                                                                           th:name="${'crCourseGrade'+cr.crId}"
                                                                                           th:value="3"
                                                                                           th:checked="${cr.crCourseGrade=='3'}">
                                                                                    <label th:for="${'three'+cr.crId}">
                                                                                        <svg xmlns="http://www.w3.org/2000/svg"
                                                                                             width="56.5px"
                                                                                             height="53.5px">
                                                                                            <path/>
                                                                                        </svg>
                                                                                    </label>
                                                                                    <input type="radio"
                                                                                           th:id="${'four'+cr.crId}"
                                                                                           th:name="${'crCourseGrade'+cr.crId}"
                                                                                           th:value="2"
                                                                                           th:checked="${cr.crCourseGrade=='2'}">
                                                                                    <label th:for="${'four'+cr.crId}">
                                                                                        <svg xmlns="http://www.w3.org/2000/svg"
                                                                                             width="56.5px"
                                                                                             height="53.5px">
                                                                                            <path/>
                                                                                        </svg>
                                                                                    </label>
                                                                                    <input type="radio"
                                                                                           th:id="${'five'+cr.crId}"
                                                                                           th:name="${'crCourseGrade'+cr.crId}"
                                                                                           th:value="1"
                                                                                           th:checked="${cr.crCourseGrade=='1'}">
                                                                                    <label th:for="${'five'+cr.crId}">
                                                                                        <svg xmlns="http://www.w3.org/2000/svg"
                                                                                             width="56.5px"
                                                                                             height="53.5px">
                                                                                            <path/>
                                                                                        </svg>
                                                                                    </label>
                                                                                </div>
                                                                            </div>
                                                                            <div class="form-group">
                                                                                <label> 课程评价：</label>
                                                                                <div>
                                                                                <textarea
                                                                                        th:id="${'crCourseEvaluation'+ cr.crId}"
                                                                                        class="form-control" rows="3"
                                                                                        cols="60"
                                                                                        name="crCourseEvaluation"
                                                                                        placeholder="请输入你的宝贵意见"
                                                                                        th:value="${cr.crCourseEvaluation}">[[${cr.crCourseEvaluation}]]
                                                                                </textarea>
                                                                                    <br>
                                                                                    <div style="width: 100%;text-align: right">
                                                                                        <button type="button"
                                                                                                th:onclick="deleteEval([[${cr.crId}]])"
                                                                                                class="btn btn-danger btn-xs"
                                                                                                style="margin-right: 2px">
                                                                                            <i class="fa fa-trash"></i>
                                                                                            清空
                                                                                        </button>
                                                                                    </div>
                                                                                </div>
                                                                            </div>

                                                                        </div>
                                                                    </form>
                                                                </div>
                                                                <!-- /.box-body -->
                                                            </div>
                                                            <!-- /.box -->
                                                        </div>
                                                        <!-- /.col -->
                                                    </div>
                                                </div>
                                                <div class="modal-footer">
                                                    <button type="button" class="btn btn-default btn-sm"
                                                            data-dismiss="modal"
                                                            th:onclick="cancelEval([[${cr.crCourseGrade}]],[[${cr.crId}]])">
                                                        &nbsp;&nbsp;取&nbsp;&nbsp;&nbsp;消&nbsp;&nbsp;
                                                    </button>
                                                    <button id="gradeBtn" type="button" class="btn btn-success btn-sm"
                                                            data-dismiss="modal"
                                                            th:onclick="evaluationSubmit([[${cr.crId}]])">
                                                        <i class="fa fa-check-square"></i>&nbsp;&nbsp;&nbsp;提&nbsp;&nbsp;&nbsp;交&nbsp;&nbsp;
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                                <td style="line-height: 25px">
                                    <a class="btn btn-info btn-xs" data-toggle="modal"
                                       th:data-target="${'#detilModal'+cr.crId}">
                                        <i class="fa fa-info"></i> 查看详情
                                    </a>
                                    <a class="btn btn-warning btn-xs" th:onclick="modify([[${cr.crId}]])">
                                        <i class="fa fa-edit"></i> 修改
                                    </a>
                                    <a th:if="${session.user.authority!=3}" class="btn btn-danger btn-xs"
                                       th:onClick="cr_delete(this,[[${cr.crId}]])">
                                        <i class="fa fa-trash"></i> 删除
                                    </a>
                                    <!-- Modal -->
                                    <div class="modal fade " th:id="${'detilModal'+cr.crId}" tabindex="-1"
                                         role="dialog"
                                         aria-labelledby="myModalLabel">
                                        <div class="modal-dialog modal-lg" role="document" style="width: 60%">
                                            <div class="modal-content">
                                                <div class="modal-header">
                                                    <button type="button" class="close" data-dismiss="modal"
                                                            aria-label="Close">&nbsp;&nbsp;&times;&nbsp;&nbsp;
                                                    </button>
                                                    <h4 class="modal-title" id="myModalLabel"><i
                                                            class="fa fa-info"></i>
                                                        合作成果详情
                                                    </h4>
                                                </div>
                                                <div class="modal-body">
                                                    <table class="table table-striped table-bordered">
                                                        <tbody>
                                                        <tr>
                                                            <td><strong>合作日期:</strong></td>
                                                            <td colspan="3">[[${#dates.format(cr.crDate,
                                                                'yyyy-MM-dd')}]]
                                                            </td>
                                                        </tr>
                                                        <tr>
                                                            <td><strong>成果类型:</strong></td>
                                                            <td>[[${cr.crType}]]</td>
                                                            <td><strong>成果主题:</strong></td>
                                                            <td>[[${cr.crTopic}]]</td>
                                                        </tr>
                                                        <tr>
                                                            <td><strong>预期主题单价:</strong></td>
                                                            <td>[[${cr.crTopicUnitprice}]]</td>
                                                            <td><strong>预期主题总价:</strong></td>
                                                            <td>[[${cr.crTopicTotalprice}]]</td>
                                                        </tr>
                                                        <tr>
                                                            <td><strong>主题要求:</strong></td>
                                                            <td>[[${cr.crTopicRequire}]]</td>
                                                            <td><strong>授课讲师:</strong></td>
                                                            <td>[[${cr.crCourseTeacher}]]</td>
                                                        </tr>
                                                        <tr>
                                                            <td><strong>预期参与人数:</strong></td>
                                                            <td>[[${cr.crPersonNum}]]</td>
                                                            <td><strong>销售专员:</strong></td>
                                                            <td>[[${cr.crSales}]]</td>
                                                        </tr>
                                                        <tr>
                                                            <td><strong>备注:</strong></td>
                                                            <td style="word-break:break-all;" colspan="3">
                                                                [[${cr.crRemark}]]
                                                            </td>
                                                        </tr>
                                                        </tbody>
                                                    </table>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                            </tbody>
                            <tfoot>
                            <tr>
                                <td>
                                    <input type="checkbox" name="" id="checkAllId" value=""
                                           onchange="checkAllId(this)">
                                </td>
                                <td colspan="8" style="text-align:left;padding-left:20px;">
                                    <button th:if="${session.user.authority!=3}" class="btn btn-danger btn-sm"
                                            th:onclick="crs_Delete()">
                                        <i class="fa fa-trash"></i> 批量删除
                                    </button>&nbsp;&nbsp;
                                    <a class="btn btn-primary btn-sm" th:href="@{/cr/exportTemplate}"
                                       onclick="layer.msg('正在导出,请稍等...', { icon: 1, time: 1000 });">
                                        <i class="fa fa-download"></i> 导出当前页EXCEL模板
                                    </a>

                                    <a th:if="${session.user.authority==1}" class="btn btn-primary btn-sm"
                                       th:href="@{/cr/export}"
                                       onclick="layer.msg('正在导出,请稍等...', { icon: 1, time: 1000 });">
                                        <i class="fa fa-download"></i> 导出到EXCEL
                                    </a>

                                    <a class="btn btn-primary btn-sm" data-toggle="modal" data-target="#mydialog1">
                                        <i class="fa fa-upload"></i> 导入EXCEL
                                    </a>
                                </td>
                            </tr>
                            </tfoot>
                        </table>
                        <!-- 分页 -->
                        <nav aria-label="Page navigation" style="text-align: right;">
                            <ul class="pagination">

                                <li>
                                    <a th:if="${pageBean.pageNum!=1 && searchURL==null}"
                                       th:href="@{/cr/crShow(pageSize=${pageSize})}">首页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum!=1 && searchURL!=null }"
                                       th:href="@{${searchURL}(pageSize=${pageSize})}">首页</a>
                                </li>

                                <li>
                                    <a th:if="${pageBean.pageNum==1 && searchURL==null}"
                                       href="javascript:void(0)">首页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum==1 && searchURL!=null }"
                                       th:href="@{${searchURL}(pageSize=${pageSize})}">首页</a>
                                </li>

                                <li th:if="${pageBean.pageNum!=1 && searchURL==null}">
                                    <a th:href="@{/cr/crShow(currentPage=${(pageBean.pageNum)-1},pageSize=${pageSize})}"
                                       aria-label="Previous">
                                        <span aria-hidden="true"><<</span>
                                    </a>
                                </li>
                                <li th:if="${pageBean.pageNum!=1 && searchURL!=null }">
                                    <a id="leftPage"
                                       th:href="@{${searchURL}(currentPage=${(pageBean.pageNum)-1},pageSize=${pageSize})}"
                                       aria-label="Previous">
                                        <span aria-hidden="true"><<</span>
                                    </a>
                                </li>

                                <li class="disabled" th:if="${pageBean.pageNum==1 }">
                                    <a href="javascript:void(0)" aria-label="Previous">
                                        <span aria-hidden="true"><<</span>
                                    </a>
                                </li>

                                <li th:classappend="${pageBean.pageNum==pageIndex}?'active':''"
                                    th:each="pageIndex:${pageValue}">
                                    <a href="javascript:void(0)"
                                       th:if="${pageBean.pageNum==pageIndex}"
                                       th:text="${pageIndex}"></a>
                                    <a th:if="${pageIndex==-1}" style="cursor: default;opacity: 0.6;">
                                        ...
                                    </a>
                                    <a th:if="${pageBean.pageNum!=pageIndex&&pageIndex!=-1 && searchURL==null}"
                                       th:href="@{/cr/crShow(currentPage=${pageIndex},pageSize=${pageSize})}"
                                       th:text="${pageIndex}"></a>
                                    <a th:if="${pageBean.pageNum!=pageIndex&&pageIndex!=-1 && searchURL!=null}"
                                       th:href="@{${searchURL}(currentPage=${pageIndex},pageSize=${pageSize})}"
                                       th:text="${pageIndex}"></a>
                                </li>

                                <li class="disabled" th:if="${pageBean.pageNum==pageBean.pages }">
                                    <a href="javascript:void(0)" aria-label="Next">
                                        <span aria-hidden="true">>></span>
                                    </a>
                                </li>

                                <li th:if="${pageBean.pageNum!=pageBean.pages && searchURL==null}">
                                    <a th:href="@{/cr/crShow(currentPage=${pageBean.pageNum+1},pageSize=${pageSize})}"
                                       aria-label="Next"> <span aria-hidden="true">>></span>
                                    </a>
                                </li>
                                <li th:if="${pageBean.pageNum!=pageBean.pages && searchURL!=null}">
                                    <a th:href="@{${searchURL}(currentPage=${pageBean.pageNum+1},pageSize=${pageSize})}"
                                       aria-label="Next"> <span aria-hidden="true">>></span>
                                    </a>
                                </li>

                                <li>
                                    <a th:if="${pageBean.pageNum!=pageBean.pages && searchURL==null}"
                                       th:href="@{/cr/crShow(currentPage=${pageBean.pages},pageSize=${pageSize})}">末页</a>
                                </li>
                                <li>
                                    <a th:if="${pageBean.pageNum!=pageBean.pages && searchURL!=null}"
                                       th:href="@{${searchURL}(currentPage=${pageBean.pages},pageSize=${pageSize})}">末页</a>
                                </li>

                                <li>
                                    <a th:if="${pageBean.pageNum==pageBean.pages }"
                                       href="javascript:void(0)">末页</a>
                                </li>
                            </ul>
                        </nav>
                        <input id="currentPage" th:value="${pageBean.pageNum}" hidden>
                        <input id="currentPageSize" th:value="${pageBean.size}" hidden>
                        <input id="pageSizeOld" th:value="${pageSize}" hidden>
                        <input id="lastPage" th:value="${pageBean.pages}" hidden>
                        <input id="comId" th:value="${comId}" hidden>
                    </div>
                    <!-- /.box-body -->
                </div>
                <!-- /.box -->
            </div>
            <!-- /.col -->
        </div>
        <!-- /.row -->
    </section>
    <!-- /.content -->
</div>
<!-- ./wrapper -->
<!-- DataTables -->
<script th:src="@{/asserts/bower_components/datatables.net/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/asserts/bower_components/datatables.net-bs/js/dataTables.bootstrap.min.js}"></script>
<!-- SlimScroll -->
<script th:src="@{/asserts/bower_components/jquery-slimscroll/jquery.slimscroll.min.js}"></script>
<!-- FastClick -->
<script th:src="@{/asserts/bower_components/fastclick/lib/fastclick.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/asserts/dist/js/adminlte.min.js}"></script>
<!-- AdminLTE for demo purposes -->
<script th:src="@{/asserts/dist/js/demo.js}"></script>
<!-- page script -->
<script>

    /*排序*/
    $('#myTable').dataTable({
            "aaSorting": [
                [1, "desc"]
            ],//默认第2列降序
            "aoColumnDefs": [{"bSortable": false, "aTargets": [0, 2, 3, 4, 5, 6, 7, 8]}],
            "paging": false, //关闭页码
            "lengthChange": false,//关闭每页显示多少个选项
            "info": false,//关闭页码底端信息
            "searching": false,//关闭搜索栏
        }
    )

    /*置顶*/
    $(function () {
        $(window).scroll(function () {
            if ($(window).scrollTop() > 150) {
                $('#top').css('display', 'block');    //<div id-'top'></div>假如有这么个div是那个向上图标的div。css默认none
            } else {
                $('#top').css('display', 'none');
            }
        });
    });

    /*修改*/
    function modify(crId) {
        var pageSizeOld = $("#pageSizeOld").val();
        var currentPage = $("#currentPage").val();
        var comId = $("#comId").val();
        var crDate = $("#crDate").val();
        var crSales = $("#crSales").val();
        var crTopic = $("#crTopic").val();
        var crCourseTeacher = $("#crCourseTeacher").val();
        if ((location.href).indexOf("/cr/crShow") !== -1) {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crModifyUI?crId=" + crId + "&currentPage=" + currentPage + "&pageSize=" + pageSizeOld;
        } else {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crModifyUI?crId=" + crId + "&currentPage=" + currentPage + "&pageSize=" + pageSizeOld + "&ccrcDate=" + crDate + "&ccrcSales=" + crSales + "&ccrcTopic=" + crTopic + "&ccrcCourseTeacher=" + crCourseTeacher + "&comId=" + comId;
        }
    }

    /*每页显示*/
    function pageFun(obj) {
        if ((location.href).indexOf("/cr/crShow") !== -1) {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crShow?pageSize=" + $(obj).val();
        } else {
            location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crSearchShow?pageSize=" + $(obj).val() + "&ccrcDate=" + $("#crDate").val() + "&ccrcCourseTeacher=" + $("#crCourseTeacher").val() + "&ccrcTopic=" + $("#crTopic").val() + "&ccrcSales=" + $("#crSales").val();
        }

    }

    /*类型*/
    function typeFun(obj) {
        location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crSearchShow?pageSize=" + $("#pageSize").val() + "&ccrcDate=" + $("#crDate").val() + "&ccrcCourseTeacher=" + $("#crCourseTeacher").val() + "&ccrcTopic=" + $("#crTopic").val() + "&ccrcSales=" + $("#crSales").val();
    }

    /*非空判定*/
    $("form").submit(
        function () {
            var crDate = $("#crDate").val();
            var crCourseTeacherer = $("#crCourseTeacher").val();
            var crTopic = $("#crTopic").val();
            var crSales = $("#crSales").val();
            if ((crDate == null || crDate === "") && (crCourseTeacherer == null || crCourseTeacherer === "") && (crTopic == null || crTopic === "") && (crSales == null || crSales === "")) {
                layer.msg('亲，查询内容不能为空哦!', {
                    icon: 0,
                    time: 1500
                });
                return false;
            }
            return true;
        }
    );

    var idArr = [];

    /*记住单个id*/
    function recordId(obj) {
        if (idArr.length === 0 || obj.checked === true) {
            idArr.push(obj.value);
        } else {
            for (var index in idArr) {
                if (idArr[index] === obj.value) {
                    delete idArr[index];
                }
            }
        }
    }

    /*记录所有id*/
    function checkAllId(obj) {

        var checknames = document.getElementsByName("crIds");
        for (var i = 0; i < checknames.length; i++) {
            checknames[i].checked = obj.checked;
            if (obj.checked) {
                idArr.push(checknames[i].value);
            } else {
                idArr.length = 0;
            }
        }
    }

    /*删除-批量*/
    function crs_Delete() {
        var flag = true;
        for (var index in idArr) {
            if (idArr[index] != null) {
                flag = false;
            }
        }
        if (idArr.length === 0 || flag) {
            layer.msg('亲，请先选择要删除的项哦!', {
                icon: 0,
                time: 1500
            });
        } else {
            layer.confirm("确认要删除吗？",
                {
                    btn: ['确定', '取消']
                },
                function () {
                    var crIdStr = idArr.toString();
                    var currentPageSize = $("#currentPageSize").val();
                    var currentPage = $("#currentPage").val();
                    var lastPage = $("#lastPage").val();
                    $.ajax({
                        type: 'POST',
                        url: './crsDelete?crIdStr=' + crIdStr + '&currentPageSize=' + currentPageSize + '&currentPage=' + currentPage + '&lastPage=' + lastPage,
                        success: function (data) {
                            if (data.id === 0) {
                                layer.msg(data.data, {
                                    icon: 1,
                                    time: 500
                                });
                                setTimeout(function () {
                                    if ((location.href).indexOf("/cr/crShow") !== -1) {
                                        location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crShow?pageSize=" + $("#pageSize").val() + "&currentPage=" + (currentPage - 1);
                                    } else {
                                        location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crSearchShow?pageSize=" + $("#pageSize").val() + "&ccrcDate=" + $("#crDate").val() + "&ccrcCourseTeacher=" + $("#crCourseTeacher").val() + "&ccrcTopic=" + $("#crTopic").val() + "&ccrcSales=" + $("#crSales").val() + "&currentPage=" + (currentPage - 1);
                                    }
                                }, 500);
                            } else if (data.id === 1) {
                                layer.msg(data.data, {
                                    icon: 1,
                                    time: 500
                                });
                                setTimeout(function () {
                                    location.replace(location.href);
                                }, 500);
                            } else {
                                layer.msg(data.data, {
                                    icon: 0,
                                    time: 2000
                                });
                            }
                        },
                        error: function (data) {
                            console.log(data.msg);
                        }
                    });
                },
                function () {
                    layer.msg("已取消！", {
                        icon: 0,
                        time: 500
                    });
                    return false;
                }
            );
        }
    }

    /*删除-单个*/
    function cr_delete(obj, crId) {
        layer.confirm("确认要删除吗？",
            {
                btn: ['确定', '取消']
            },
            function () {
                var currentPageSize = $("#currentPageSize").val();
                var currentPage = $("#currentPage").val();
                var lastPage = $("#lastPage").val();
                $.ajax({
                    type: 'POST',
                    url: './crDelete?crId=' + crId + '&currentPageSize=' + currentPageSize + '&currentPage=' + currentPage + '&lastPage=' + lastPage,
                    success: function (data) {
                        if (data.id === 0) {
                            layer.msg(data.data, {
                                icon: 1,
                                time: 500
                            });
                            setTimeout(function () {
                                if ((location.href).indexOf("/cr/crShow") !== -1) {
                                    location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crShow?pageSize=" + $("#pageSize").val() + "&currentPage=" + (currentPage - 1);
                                } else {
                                    location.href = "[[${#httpServletRequest.getContextPath()}]]/cr/crSearchShow?pageSize=" + $("#pageSize").val() + "&ccrcDate=" + $("#crDate").val() + "&ccrcCourseTeacher=" + $("#crCourseTeacher").val() + "&ccrcTopic=" + $("#crTopic").val() + "&ccrcSales=" + $("#crSales").val() + "&currentPage=" + (currentPage - 1);
                                }
                            }, 500);
                        } else if (data.id === 1) {
                            layer.msg(data.data, {
                                icon: 1,
                                time: 500
                            });
                            setTimeout(function () {
                                location.replace(location.href);
                            }, 500);
                        } else {
                            layer.msg(data.data, {
                                icon: 0,
                                time: 2000
                            });
                        }
                    },
                    error: function (data) {
                        console.log(data.msg);
                    }
                });
            },
            function () {
                layer.msg("已取消！", {
                    icon: 0,
                    time: 500
                });
                return false;
            }
        );
    }

    /*联想输入*/
    $(function () {
        $("#crTopic").topicAutoComplete({
            url: '[[${#httpServletRequest.getContextPath()}]]/find/topicJson',
        });
    })

    $(function () {
        $("#crCourseTeacher").teacherAutoComplete({
            url: '[[${#httpServletRequest.getContextPath()}]]/find/teacherJson',
        });
    })

    $(function () {
        $("#crSales").bigAutocomplete({
            url: '[[${#httpServletRequest.getContextPath()}]]/find/salesJson',
        });
    })

    var temp = 0;

    /*评价*/
    function evaluationSubmit(crId) {
        var radios = document.getElementsByName("crCourseGrade" + crId);
        var crCourseGrade = 0;
        for (let i = 0; i < radios.length; i++) {
            if (radios[i].checked === true) {
                crCourseGrade = radios[i].value;
            }
        }
        var crEvaluation = $("#crCourseEvaluation" + crId).val();
        $.ajax({
            type: 'POST',
            url: './crEvaluation?crId=' + crId + '&crCourseGrade=' + crCourseGrade + '&crCourseEvaluation=' + crEvaluation,
            success: function (data) {
                if (data.id === 0) {
                    layer.msg(data.data, {
                        icon: 1,
                        time: 500
                    });
                    temp = crCourseGrade;
                } else {
                    layer.msg(data.data, {
                        icon: 0,
                        time: 2000
                    });
                }
            },
            error: function (data) {
                console.log(data.msg);
            }
        })
    }

    /*清空*/
    function deleteEval(crId) {
        var radios = document.getElementsByName("crCourseGrade" + crId);
        for (let i = 0; i < radios.length; i++) {
            if (radios[i].checked === true) {
                radios[i].checked = false;
            }
        }
        document.getElementById("crCourseEvaluation" + crId).value = "暂无评价哦！"
    }

    /*取消*/
    function cancelEval(crCourseGrade, crId) {
        var radios = document.getElementsByName("crCourseGrade" + crId);
        if (temp != 0) {
            crCourseGrade = temp;
        }
        if (crCourseGrade != 0) {
            radios[5 - crCourseGrade].checked = true;
        } else {
            for (let i = 0; i < radios.length; i++) {
                radios[i].checked = false;
            }
        }
    }

    /*文件上传*/
    var $uploadExcel = $("#input-b2");

    function uploadExcel() {
        if ($uploadExcel.val() === "") {
            layer.msg('亲，请选择文件哦!', {
                icon: 0,
                time: 1500
            });
        } else {
            var file = document.getElementById("input-b2").files[0];
            var formData = new FormData();
            formData.append("file", file);
            layer.msg("正在导入,请稍等...", {
                icon: 1,
                time: 1000
            });
            $.ajax({
                type: 'POST',
                url: './crUploadExcel',
                data: formData,
                dataType: 'json',
                processData: false,
                contentType: false,
                mimeType: "multipart/form-data",
                success: function (data) {
                    if (data.id === 0) {
                        layer.msg(data.data, {
                            icon: 1,
                            time: 500
                        });
                        $('#mydialog1').modal('hide');
                        setTimeout(function () {
                            location.replace(location.href);
                        }, 500);
                    } else {
                        layer.msg(data.data, {
                            icon: 0,
                            time: 2000
                        });
                        $('#mydialog1').modal('hide');
                    }
                },
                error: function (data) {
                    console.log(data.msg);
                }
            })
        }
    }
</script>
</body>
</html>